UdipWeb::Application.routes.draw do
  
  resources :groups_threads, :path => "tema"
  resources :groups, :path => "grupe"
  resources :members, :path => "clanovi"

  resources :groups_sections
  resources :groups_posts
  resources :comments
  resources :widgets
  resources :pms
  resources :messages
  resources :images
  resources :pages
  resources :profiles
  resources :tutorials
  resources :tutorial_categories
  resources :categories
  resources :posts
  resources :users
  
  devise_for :members

	match 'feed' => "posts#feed"
  match 'grupe/:id/mark_all_as_visited' => "groups#mark_all_as_visited", :as => :mark_all_as_visited
  match 'grupe/:id/add_members' => "groups#save_members", :via => :post
  match 'grupe/:id/add_members' => "groups#add_members", :as => :add_members_to_group
 	match 'grupe/:id/:slug' => "groups#show"
  match 'tema/:id/:thread_slug/:post_slug' => "groups_threads#show"
  match 'groups_threads/new/:group_id' => "groups_threads#new", :as => :new_groups_thread_id
  match 'groups_posts/new/:thread_id' => "groups_posts#new", :as => :new_groups_post_id
  match 'pms/new/:to' => "pms#sendto", :as => :send_pm
  match 'members/edit_avatar/:id' => "members#update_avatar", :via => :post
  match 'members/edit_avatar/:id' => "members#edit_avatar"
  match 'members/home' => "members#home", :as => :member_root
  match 'groups/:id/join' => "groups#join", :as => :join_group
  match 'groups/:id/leave' => "groups#leave", :as => :leave_group
  match 'prijavi_se' => "members#sign_in", :as => :login
  match 'session/login' => 'session#do_login', :via => :post
  match 'registracija' => 'users#new'
    match 'novosti/admin' => "posts#index_admin", :as => :posts_admin
  match 'tutoriali/admin' => "tutorial_categories#index_admin", :as => :tutorials_admin
  match 'tutoriali' => "tutorial_categories#index", :as => :frontend_tutorial_index
  match 'tutorial/:slug' => "tutorials#show", :as => :frontend_tutorial
  match 'tutoriali/:slug' => "tutorial_categories#show", :as => :frontend_tutorial_category
  match 'kategorija/:category' => "posts#category", :as => :frontend_category
  match ':category/:slug' => "posts#show", :as => :frontend_post
  match ':slug' => "pages#show", :as => :frontend_page
  
  root :to => 'posts#index'

  # The priority is based upon order of creation:
  # first created -> highest priority.

  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Sample resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Sample resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Sample resource route with more complex sub-resources
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', :on => :collection
  #     end
  #   end

  # Sample resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end

  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  # root :to => "welcome#index"

  # See how all your routes lay out with "rake routes"

  # This is a legacy wild controller route that's not recommended for RESTful applications.
  # Note: This route will make all actions in every controller accessible via GET requests.
  # match ':controller(/:action(/:id(.:format)))'
end
